package com.wangjie.business.controller;

import com.wangjie.business.service.BusinessService;
import com.wangjie.common.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BusinessController {
    @Autowired
    private BusinessService businessService;

    /**
     * 购买
     *
     * @param userId        用户id
     * @param commodityCode 商品编号
     * @param count         购买数量
     * @return
     */
    @GetMapping("/purchase")
    public R purchase(@RequestParam("userId") String userId, @RequestParam("commodityCode") String commodityCode, @RequestParam("count") int count) {
        businessService.purchase(userId, commodityCode, count);
        return R.ok("purchase success...");
    }
}